package com.example.config;

import com.example.model.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Description:统一异常处理
 * User: 阿宾
 * Date: 2025-05-13
 * Time: 21:12
 */
@Slf4j
@ControllerAdvice
@ResponseBody
public class ExceptionAdvice {
    @ExceptionHandler
    public Result handlerException(Exception e){
        log.error("发生异常：",e);
        return Result.fail(e.getMessage());
    }
}
